﻿using ProtoBuf;
using ProtoBuf.Grpc.Configuration;

namespace ProtobufNetShared
{
    [Service]
    public interface IOrderService
    {
        CreateResult CreateOrder(CreateRequest request);
        QueryResult QueryOrder(QueryRequest request);
    }

    [ProtoContract]
    public class CreateRequest
    {
        [ProtoMember(1)]
        public string OrderNo { get; set; }

        [ProtoMember(2)]
        public string OrderName { get; set; }

        [ProtoMember(3)]
        public string Price { get; set; }
    }

    [ProtoContract]
    public class CreateResult
    {
        [ProtoMember(1)]
        public bool Result { get; set; }

        [ProtoMember(2)]
        public string Message { get; set; }
    }

    [ProtoContract]
    public class QueryRequest
    {
        [ProtoMember(1)]
        public int Id { get; set; }
    }

    [ProtoContract]
    public class QueryResult
    {
        [ProtoMember(1)]
        public int Id { get; set; }

        [ProtoMember(2)]
        public string OrderNo { get; set; }

        [ProtoMember(3)]
        public string OrderName { get; set; }

        [ProtoMember(4)]
        public double Price { get; set; }
    }

}
